<template>
  <div>
    <!-- 三级联动已经注册为全局组件，不需要引入 -->
    <Typenav />
    <List />
    <Recommend />
    <Rank />
    <Like />
    <Floor v-for="(floor) in floorList" :key="floor.id" :floor='floor'/> 
    <Brand />
  </div>
</template>

<script>
import List from "./List/listbox";
import Recommend from "./Recommend/recommend";
import Rank from "./Rank/rank.vue";
import Like from "./Like/like.vue";
import Floor from "./Floor/floor.vue";
import Brand from "./Brand/brand.vue";

import { mapState } from "vuex";
import store from '../../store/vuex'

export default {
  mounted() {
    //这个不能在floor组件中，不然两个floor会出现相同的数据，不能遍历
    this.$store.dispatch("getFloor");
    this.getuserinfo()
    
  },
  methods:{
    getuserinfo(){
      if(store.state.user.token){
        this.$store.dispatch('getUserinfo')
      }
    }
  },
  components: {
    List,
    Recommend,
    Rank,
    Like,
    Floor,
    Brand,
  },
  computed: {
    ...mapState(["count"]),
    ...mapState({
      floorList: (state) => {
        return state.home.floorList;
      },
    }),
  },
};
</script>

<style>
</style>